<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Login</title>
    <link rel="stylesheet" type="text/css" href="assets/css/login.css"/>
    <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>

</head>
<body>
<div id="login">
    <h1>Login</h1>
        <input type="text"  placeholder="用户名" id="email" name="email"></input>

        <input type="password"  placeholder="密码" id="pwd" name="pwd"></input>

        <button class="but" type="submit" id="loginUser" style="width: 300px;">登录</button>

        <a href="http://www.test.com/register.html" class="but"  style="text-align: center;width: 271px;">
            注册
        </a>

</div>
</body>
<script>
    $(function(){
        $("#loginUser").click(function(){
            let email=$("#email").val();
            let pwd=$("#pwd").val();
            $.ajax({
                url: "http://www.test.com/userserver/login",
                data: {email:email,pwd:pwd},
                type: "POST",
                dataType: "text",
                success: function(data) {
                    if (data=="success"){
                        window.location="http://www.test.com/test.html";
                    } else {
                        alert(data)
                    }
                }
            })
        })

})
</script>
</html>
